package com.lwj.controller.configuration;

import com.lwj.dto.configuration.AttConfigurationDto;
import com.lwj.dto.configuration.AttConfigurationListDto;
import com.lwj.dto.system.MenuDto;
import com.lwj.entity.RestEntity;
import com.lwj.service.configuration.AttConfigurationService;
import com.lwj.vo.PageBean;
import com.lwj.vo.configuration.AttConfigurationVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags ="附件管理接口")
@RestController()
@RequestMapping("/api/attConfiguration")
public class AttConfigurationController {
    @Autowired
    private AttConfigurationService attConfigurationService;

    @ApiOperation(value = "列表")
    @PostMapping("/list")
    public RestEntity<PageBean<AttConfigurationVo>> list(@RequestBody  AttConfigurationListDto dto){
        return RestEntity.success(attConfigurationService.list(dto));
    }
    @ApiOperation(value = "保存")
    @PostMapping("/save")
    public RestEntity<String> save(@RequestBody @Valid AttConfigurationDto dto){
        return RestEntity.success(attConfigurationService.save(dto));
    }
    @ApiOperation(value = "查询")
    @GetMapping("/select")
    public RestEntity<AttConfigurationVo> select(String attConfigurationId ){
        return RestEntity.success(attConfigurationService.select(attConfigurationId));
    }
    @ApiOperation(value = "删除")
    @GetMapping("/delete")
    public RestEntity<String> delete(@RequestParam("attConfigurationId") String attConfigurationId){
        attConfigurationService.deleteByPrimaryKey(attConfigurationId);
        return RestEntity.success();
    }
}
